package com.study.other;

import java.math.BigDecimal;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import lombok.Data;

/**
 * @Author tanglingyu
 * @Date: 2021/08/24/ 19:50
 * @Description
 */
public enum MyEnum {

  SB("傻逼", (obj, sl) -> obj.setSl(new BigDecimal(sl)));

  private String code;

  private BiConsumer<MyDto, String> consumer;

  private MyEnum(String code, BiConsumer<MyDto, String> consumer) {
    this.code = code;
    this.consumer = consumer;
  }


  public static void main(String[] args) {
    final MyEnum sb = MyEnum.SB;
    MyDto myDto = new MyDto();
    sb.consumer.accept(myDto, "100.0");
    System.out.println(myDto);
  }

  @Data
  static class MyDto {

    private BigDecimal sl;
  }

}